package main

import (
	"TodoList/cache"
	"TodoList/dao"
	"TodoList/logm"
	"TodoList/server"
	"github.com/gin-gonic/gin"
	"io"
	"os"
)

func configLogger() {
	gin.DisableConsoleColor()
	f, _ := os.Create("/logs/gin.log")
	gin.DefaultWriter = io.MultiWriter(f)
	logm.NewLogger("/logs/goWeb.log")
	logm.Smile.Println("config log complete")
}

func main() {
	// 装载路由
	r := server.NewRouter()
	//初始化日志配置
	configLogger()
	//初始化数据库
	dao.DataBase()
	logm.Smile.Println("postgres connected")
	//初始化redis缓存
	cache.InitRedis()
	logm.Smile.Println("Redis connected")
	r.Run(":8080")
}
